package com.ityj.yygh.hospital.controller;

import com.ityj.yygh.hospital.service.ScheduleService;
import com.ityj.yygh.model.hosp.Schedule;
import com.ityj.yygh.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(value = "医院排班信息管理")
@RestController
@RequestMapping(path = "/admin/hosp/schedule")
@Slf4j
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation(value = "根据医院编号和科室编号获取排班信息")
    @GetMapping(path = "/findScheduleRule/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public Result<Map<String, Object>> findScheduleRule(@PathVariable Integer pageNum,
                                                        @PathVariable Integer pageSize,
                                                        @PathVariable String hoscode,
                                                        @PathVariable String depcode) {
        Map<String, Object> result = scheduleService.findScheduleRule(pageNum, pageSize, hoscode, depcode);
        return Result.ok(result);
    }

    @ApiOperation(value = "根据医院编号、科室编号和工作日期 获取排班具体信息")
    @GetMapping(path = "/findScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result<List<Schedule>> findScheduleDetail(@PathVariable String hoscode,
                                                     @PathVariable String depcode,
                                                     @PathVariable String workDate) {
        List<Schedule> result = scheduleService.findScheduleDetail(hoscode, depcode, workDate);
        return Result.ok(result);
    }
}
